DEBUG=yes
CC=gcc
CFLAGS=-W -Wall -Wextra `pkg-config --cflags --libs glib-2.0`
ifeq ($(DEBUG), yes)
	$(CFLAGS)=$(CFLAGS) -g
endif
LDFLAGS=
EXEC=example
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)

all: $(EXEC)
ifeq ($(DEBUG), yes)
	@echo "Génération en mode debug"
else
	@echo "Génération en mode release"
endif

thread.o: thread.h

example: $(OBJ)
	$(CC) $^ -o $@ $(CFLAGS) $(LDFLAGS)

%.o: %.c
	$(CC) -o $@ -c $< $(CFLAGS)

.PHONY: clean mrproper

clean:
	rm -rf *.o

mrproper: clean
	rm -rf $(EXEC)
